using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Windows.Forms;

namespace MyPhotoIndex.Utilities
{
    public class LocalizedComponentResourceManager : ComponentResourceManager
    {
         // Summary:
        //     Initializes a new instance of the MyPhotoIndex.Utilities.LocalizedComponentResourceManager
        //     class with default values.
        public LocalizedComponentResourceManager()
            :
            base() { }
        //
        // Summary:
        //     Creates a MyPhotoIndex.Utilities.LocalizedComponentResourceManager that looks up resources
        //     in satellite assemblies based on information from the specified System.Type.
        //
        // Parameters:
        //   t:
        //     A System.Type from which the MyPhotoIndex.Utilities.LocalizedComponentResourceManager
        //     derives all information for finding resource files.
        public LocalizedComponentResourceManager(Type t)
            :
            base(t) { }

        public override void ApplyResources(object value, string objectName, System.Globalization.CultureInfo culture)
        {
            base.ApplyResources(value, objectName, culture);
            return;
            Type type = value.GetType();
            if (type == typeof(MenuStrip))
            {
            }
            else
            if (type == typeof(Form))
            {
                Form form = value as Form;
                String str = LocalizedResourceManager.Instance.GetString(base.BaseName, type, objectName);
                if (String.IsNullOrEmpty(str) == true)
                {

                    LocalizedResourceManager.Instance.AddString(base.BaseName, type, objectName, form.Text);
                }
                else
                {
                    form.Text = str;
                } 
            }
            else
            if (type == typeof(ToolStripMenuItem))
            {
                ToolStripMenuItem tmi = value as ToolStripMenuItem;
                String str = LocalizedResourceManager.Instance.GetString(base.BaseName, type, objectName);
                if (String.IsNullOrEmpty(str) == true)
                {

                    LocalizedResourceManager.Instance.AddString(base.BaseName, type, objectName, tmi.Text);
                }
                else
                {
                    tmi.Text = str;
                }
            }
            else
            if (type == typeof(Label))
            {
                Label label = value as Label;
                String str = LocalizedResourceManager.Instance.GetString(base.BaseName, type, objectName);
                if (String.IsNullOrEmpty(str) == true)
                {
                    LocalizedResourceManager.Instance.AddString(base.BaseName, type, objectName, label.Text);
                }
                else
                {
                    label.Text = str;
                }
            }
        }
    }

}
